package com.longge;

public class FindBottomLeftValue {

    private int max = 0, res = 0;

    public int findBottomLeftValue(TreeNode root) {
        findLeftNode(root, 1);
        return res;
    }

    private void findLeftNode(TreeNode root, int i) {
        if (root==null) return;

        i++;
        findLeftNode(root.left, i);

        findLeftNode(root.right, i);
        if (max < i-1) {
            max = i-1;
            res = root.val;
        }
    }


}
